package com.example.innovate.controller;

/*
    2021.9.13 update/
 */

import com.example.innovate.bean.Account;
import com.example.innovate.bean.Result;
import com.example.innovate.service.AchieveCompetitionService;
import com.example.innovate.service.CreatedClassService;
import com.example.innovate.service.GraduateStudentService;
import com.example.innovate.service.StudentService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/api/number")
@Api(tags = "主页面接口")
public class HomeController {
    @Autowired
    StudentService studentService;
    @Autowired
    GraduateStudentService graduateStudentService;
    @Autowired
    CreatedClassService createdClassService;
    @Autowired
    AchieveCompetitionService achieveCompetitionService;


    //@UserLoginToken
    @GetMapping(value = "/number")
    @ApiOperation("总数统计")
    public Result Number(){
        Account account =new Account();

        account.setAchieveCompetition(achieveCompetitionService.findAllNotPage().size());
        account.setGraduateStudent(graduateStudentService.findAllNotPage().size());
        account.setStudent(studentService.findAllNotPage().size());
        return new Result(200,"success","返回成功",account);
    }


}
